package cn.edu.wynu.inject;

import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Test {
    public static void main(String[] args) {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");

        // 构造器注入的student
        Object studentConstruct = context.getBean("lq");
        System.out.println(studentConstruct);

        // 属性注入的student
        Object jhy = context.getBean("jhy");
        System.out.println(jhy);

        // 可以在这里打断点查看testLazyInit对象在容器创建的时候是否已添加到容器，路径如下：
        // context->beanFactory->singletonObjects
        Object testLazyInit = context.getBean("testLazyInit");
        System.out.println(testLazyInit);
    }
}